(function(app){
	app
		.controller("content_23_commonCtrl",["$scope","$state","myFactory",'$stateParams',"$q",'$timeout','$location','$http','$ionicHistory',function($scope,$state,myFactory,$stateParams,$q,$timeout,$location,$http,$ionicHistory){

			//接收参数
			var itemId = $stateParams.itemId;//变更项目ID
			var chdrnum01 =  $stateParams.chdrnum01; //保单号
			$scope.chdrnum01=$stateParams.chdrnum01; //保单号
			var chdrcoy = $stateParams.chdrcoy; //保单公司号码
			var item23 = $stateParams.item23;
			var initFlag = false;//检测标志，在初始化函数完成后，会被置为true
			var token=sessionStorage.getItem("token");
			console.log("content_23_common begin.....");
			
			//S2020050812880-个人信息安全项目-修改变更项目录入页面的个人信息授权内容需求 add by yangyan 20200615 start
			$scope.readFlag = false;//阅读协议标志，默认为false
			//S2020050812880-个人信息安全项目-修改变更项目录入页面的个人信息授权内容需求 add by yangyan 20200615 end

			$scope.data = {
				a_lf_flag_2_checkFlagY: false,
				a_lf_flag_2_checkFlagN: false,
				//a_lf_flag_2_checkFlag: false,
				a_lf_2_ShowFlag: false,

				a_lf_flag_3_checkFlagY: false,
				a_lf_flag_3_checkFlagN: false,
				a_lf_3_ShowFlag: false,

				show_h_ow_tbr_0:false,
				show_b_ow_tbr_0:false,

				//mainLoanMoney: '',
				//otherLoanMoney: '',
				//tellReason: '',
				//tabFlag:[true,false,false]
				tabFlag:[true,false]
			};

			//单选按钮
			//radioCheck();
			//$scope.data.a_lf_flag_2_checkFlagN = false;
			//$scope.data.a_lf_flag_2_checkFlagY = true;

/**********************************************初始化函数begin****************************************************/
			var itemData="";
			var lfAge="";
			var owAge="";
			var lfSex="";
			var owSex="";
			
			//初始化
			$scope.load = function () {
				myFactory.loadingShow();//显示加载圈
				var timestamp=myFactory.getTimetamp();
				var sfis= "itemId-token-timestamp";
				var signStr="itemId="+itemId+"&token="+token+"&timestamp="+timestamp;//encodeURI(name)
				var sign = myFactory.hex(signStr);
				$http({
					method: 'GET',
					url: app.domain + 'input/saveContentItem23.action',
					params: {'itemId': itemId,'itemStr':item23,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
				}).then(function successCallback(response) {
					if (response.data.success) {
						itemData=response.data.data.itemData;
						//policy=response.data.data.policy;
						lfAge=itemData.lfAge;
						lfSex=itemData.lfSex;
						owAge=itemData.owAge;
						owSex=itemData.owSex;

						item23=itemData.item23;

						//被保人和投保人显示控制
						//健康告知
						var tbr=item23.roleFlag;
						if( tbr=="Y"){
							$scope.data.show_h_ow_tbr_0=true;
						}
						//$scope.data.show_h_ow_tbr_0=true;//测试

						//职业告知
						//	投保PB险种,需显示投保人
						var owShow=item23.roleFlagAcc;
						if( owShow=="Y" ){
							$scope.data.show_b_ow_tbr_0=true;
						}
						//$scope.data.show_b_ow_tbr_0=true;//测试

						initFlag=true;//标识初始化成功
					}
					myFactory.loadingHide();
				}, function errorCallback(response) {
//					alert('查询数据失败!');
					myFactory.loadingHide();
					myFactory.alert("","初始化失败，请返回重试!","info");
				});
			}
/**********************************************初始化函数end****************************************************/
			
			//选项卡切换
			$scope.tabChange = function(index){
				for (var i = 0; i < 2; i++) {
					if (i == index) {
						$scope.data.tabFlag[i] = true;
						console.log("select type:"+i);//H-健康告知、A-财务告知、B-职业告知

						var sourceFlag="";
						switch(i){
							case 0:
								sourceFlag="h";
								console.log("H-健康告知");//H-健康告知
								break;
							/*case 1:
								sourceFlag="a";
								console.log("A-财务告知");//A-财务告知
								break;*/
							case 1:
								sourceFlag="b";
								console.log("B-职业告知");//B-职业告知
								break;
						}

						var timestamp=myFactory.getTimetamp();
						var sfis= "itemId-token-timestamp";
						var signStr="itemId="+itemId+"&token="+token+"&timestamp="+timestamp;//encodeURI(name)
						var sign = myFactory.hex(signStr);
						//每次切换tab菜单重新获取一次后台数据
						item23={"sourceFlag":sourceFlag};
						$http({
							method: 'GET',
							url: app.domain + 'input/saveContentItem23.action',
							params: {'itemId': itemId,'itemStr':item23,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
						}).then(function successCallback(response) {
							if (response.data.success) {
								itemData=response.data.data.itemData;
								//根据不同的告知类型重新赋值
								if(sourceFlag=="h"){
									//$scope.item23_h=itemData;
								}
								/*if(sourceFlag=="a"){//财务告知
									$scope.item23_a=itemData;
									//$scope["item23_"+'a']=itemData;
									//房贷/车贷勾选按钮设置
									var a_lf_flag_2=$scope.item23_a.a_lf_flag_2;
									//if(""!=a_lf_flag_2 && undefined!=a_lf_flag_2){}
									if(a_lf_flag_2=='N'){
										//$scope.data.a_lf_flag_2_checkFlag = false;
										//$scope.data.a_lf_2_ShowFlag = false;
										$scope.data.a_lf_flag_2_checkFlagN = true;
										$scope.data.a_lf_flag_2_checkFlagY = false;
										$scope.data.a_lf_2_ShowFlag = false;
									}else if(a_lf_flag_2=='Y'){
										//$scope.data.a_lf_flag_2_checkFlag = true;
										$scope.data.a_lf_flag_2_checkFlagN = false;
										$scope.data.a_lf_flag_2_checkFlagY = true;
										$scope.data.a_lf_2_ShowFlag = true;
									}

									//房贷/车贷以外的其他负债或贷款
									var a_lf_flag_3=$scope.item23_a.a_lf_flag_3;
									if(a_lf_flag_3=='N'){
										$scope.data.a_lf_flag_3_checkFlagY = false;
										$scope.data.a_lf_flag_3_checkFlagN = true;
										$scope.data.a_lf_3_ShowFlag = false;
									}else if(a_lf_flag_3=='Y'){
										$scope.data.a_lf_flag_3_checkFlagY = true;
										$scope.data.a_lf_flag_3_checkFlagN = false;
										$scope.data.a_lf_3_ShowFlag = true;

										//a_lf_3
										var a_lf_3=$scope.item23_a.a_lf_3;
										showAnswerQueestion3(a_lf_3);
									}
									/!*var a_lf_3=$scope.item23_a.a_lf_3;
									if(""!=a_lf_3 && undefined!=a_lf_3){
										showAnswerQueestion3(a_lf_3);
									}*!/
									//var a_lf_flag_3=$scope.item23_a.a_lf_flag_3;
									//if(a_lf_flag_3='Y'){}

									//	显示第四题答案
									//a_lf_4
									var a_lf_flag_4=$scope.item23_a.a_lf_flag_4;
									if(a_lf_flag_4=='Y'){
										var a_lf_4=$scope.item23_a.a_lf_4;
										showAccountSource(a_lf_4);
									}
								}*/
								if(sourceFlag=="b"){
									//$scope.item23_b=itemData;
								}
							}
						}, function errorCallback(response) {
							myFactory.alert('','查询数据失败!','info');
						});

					}else{
						$scope.data.tabFlag[i] = false;
						console.log("not select type:"+i);
					};
				};
			}

			//是否有房贷/车贷单选按钮样式控制
			/*$scope.isMainLabel = function(){
				//alert("选择是");
				$scope.data.mainLoanFlag = true;
				modal('open','main_loan_model','overwindow','main_loan_closeX');
			}
			$scope.notMainLabel = function(){
				//alert("选择否");
				$scope.data.mainLoanFlag = false;
				if ($scope.data.mainLoanAddFlag) {
					$scope.data.mainLoanAddFlag = false;
				};
			}*/

			//是否有房贷/车贷以外的其他负债和贷款单选按钮样式控制
			/*$scope.isOtherLabel = function(){
				//alert("选择是");
				$scope.data.otherLoanFlag = true;
				modal('open','other_loan_model','overwindow','other_loan_closeX');
			}
			$scope.notOtherLabel = function(){
				//alert("选择否");
				$scope.data.otherLoanFlag = false;
				if ($scope.data.otherLoanAddFlag) {
					$scope.data.otherLoanAddFlag = false;
				};				
			}*/

			//是否有房贷/车贷告知事项弹窗关闭
			/*$scope.mainLoanModelOkClose = function(){
				console.log($scope.data.mainLoanMoney);
				console.log(angular.isNumber($scope.data.mainLoanMoney));
				if (angular.isNumber($scope.data.mainLoanMoney)) {
					$scope.data.mainLoanAddFlag =true;
				};
				modal('close','main_loan_model','overwindow','main_loan_closeX');
			}
			$scope.mainLoanModelCancelClose = function(){
				modal('close','main_loan_model','overwindow','main_loan_closeX');
			}*/

			//是否有房贷/车贷以外贷款告知事项弹窗关闭
			/*$scope.otherLoanModelOkClose = function(){
				console.log($scope.data.otherLoanMoney);
				console.log(angular.isNumber($scope.data.otherLoanMoney));
				if (angular.isNumber($scope.data.otherLoanMoney)) {
					$scope.data.otherLoanAddFlag =true;
				};
				modal('close','other_loan_model','overwindow','other_loan_closeX');
			}
			$scope.otherLoanModelCancelClose = function(){
				modal('close','other_loan_model','overwindow','other_loan_closeX');
			}*/


			//返回上一页
			$scope.goBack = function(){
				myFactory.goBack();
				/*$ionicHistory.clearCache().then(function(){
					$state.go('content_23_input',{
						changeTypeId:itemId,
						chdrnum01:chdrnum01,
						chdrcoy:chdrcoy
					});
				})*/
			}

			//关闭遮罩
			$scope.overwindowClose = function(){
				//$(".overwindow").show();
				$(".overwindow").hide();
				$(".overmodal").hide();
			}

			$scope.toHealth = function(type){
				$scope.tabChange(0);
				if(type=='lf'){//被保人
					$state.go('content_23_healthBbr',{
						itemId:itemId,chdrnum01:chdrnum01,chdrcoy:chdrcoy,item23:item23,lfAge:lfAge,lfSex:lfSex
					});
				}else{
					$state.go('content_23_healthTbr',{
						itemId:itemId,chdrnum01:chdrnum01,chdrcoy:chdrcoy,item23:item23,owAge:owAge,owSex:owSex
					});
				}
			}

			$scope.toBusiness = function(type){
				$scope.tabChange(1);
				if(type=='lf'){//被保人
					$state.go('content_23_businessBbr',{
						itemId:itemId,chdrnum01:chdrnum01,chdrcoy:chdrcoy,item23:item23
					});
				}else{
					$state.go('content_23_businessTbr',{
						itemId:itemId,chdrnum01:chdrnum01,chdrcoy:chdrcoy,item23:item23
					});
				}
			}

			//公共变量定义
			var _problemId = "" ;	//	题库编号
			var _role	= "" ;		//	答题人角色（投保人、被保人）
			var _typeHealth   = "h";	//	告知类型：健康告知
			var _typeAccount  = "a";	//	告知类型：财务告知
			var _typeBusiness = "b";	//	告知类型：职业告知
			var _splitSign = "|";		//	分割符号，用于组装多个数据元素

			var _content = "" ;
			var _contentRes="";

			/******************************************2.财务告知js脚本逻辑处理begin*********************************************/
			//	保存金额信息
			/*$scope.saveAccountMoney = function(problemId,role){
				_problemId = problemId ;
				_role	   = role;
				_content   = "" ;
				if( _problemId == "1" || _problemId == "5" ){
					_content = $("#a_" +role+ "_"+_problemId).val();
				}
				//	保存告知信息
				saveNotifyData(_typeAccount,"Y",_content);
			}

            //	保存保险费来源信息（设置固定题号为： 4_lf ）
			$scope.saveAccountSource = function(){
			//function saveAccountSource(){
				_problemId = "4" ;
				_role	   = "lf";
				var content   = "" ;	//	来源数据
				var a4 = document.getElementsByName("a_4");
				for( var i=0 ; i< a4.length ; i++ ){
					if( a4[i].checked == true ){
						content += a4[i].value + ",";
					}
				}
				console.log("checkbox:"+content);

				//	保存告知信息
				saveNotifyData(_typeAccount,"Y",content);
			}

            //	显示第四题答案信息
			function showAccountSource(a_lf_4){
				var src = a_lf_4;

				var a4 = document.getElementsByName("a_4");
				for( var i=0 ; i< a4.length ; i++ ){
					if( src.indexOf( a4[i].value ) > -1 ){
						a4[i].checked = true ;
					}else{
						a4[i].checked = false ;
					}
				}
			}
*/

			/******************************************2.财务告知js脚本逻辑处理end*********************************************/


			/**********************  财务告知 start **************************/
            //打开财务告知对话框
			$scope.openAccountPop = function(problemId,role){
			//function openAccountPop(problemId,role){
				//	保存数据
				_problemId = problemId ;
				_role	   = role ;

				//alert(role);
				var _content = $("#a_" + _role +"_" + _problemId ).val();	//	原有填写金额内容
				//var _content = $.scope.data.mainLoanMoney;

				if( _problemId == '2' ||  _problemId == '3' ) {
					//	被保人
					/*if( _role=="lf" ){
						$("#a_th_"+_problemId+"_title").html("被保险人告知事项");
					}*/
					//	被保人
					/*if( _role=="ow" ){
						$("#a_th_"+_problemId+"_title").html("投保人告知事项");
					}*/

					//	把原有值赋值到弹出框内容中
					if( _problemId == '2' ){
						$("#a_number_"+_problemId).val(_content);
					}

					if( _problemId == '3' ){
						var res3 =  $("#a_" + _role +"_" + _problemId + "_res").val();
						$("#a_number_"+_problemId).val(_content);
						$("#a_number_"+_problemId+"_res").val(res3);
					}

					//	显示弹出框
					//$("#a_pop_"+_problemId).popup("open");
					//"a_" + _role + "_flag_" + _problemId
					//$scope.data["a_" + _role + "_flag_" + _problemId+'_checkFlag']=true;
					$scope.data["a_" + _role + "_flag_" + _problemId+'_checkFlagN']=false;
					$scope.data["a_" + _role + "_flag_" + _problemId+'_checkFlagY']=true;
					console.log("N:"+$scope.data["a_" + _role + "_flag_" + _problemId+'_checkFlagN']);
					console.log("Y:"+$scope.data["a_" + _role + "_flag_" + _problemId+'_checkFlagY']);
					//$scope.data.a_lf_flag_2_checkFlag = true;
					modal('open','a_pop_'+_problemId,'overwindow','a_pop_'+_problemId+'_closeX');
				}
			}

			//确认，关闭财务告知弹出框
			$scope.confirmAccountPop = function(){
			//function closeAccountPop(){
				var _content="";
				if( _problemId == '2' ) {
					_content = $("#a_number_2").val().trim();	//	填写内容
					/*if( "" == _content ){
						document.getElementById("a_err_2").style.display="";
						return false;
					}else{
						document.getElementById("a_err_2").style.display="none";
					}*/
					if( "" == _content ){
						myFactory.alert('','请填写未偿还金额！','info');
						return false;
					}
				}
				if( _problemId == '3' ) {
					_content = $("#a_number_3").val().trim();	//	填写内容
					_contentRes = $("#a_number_3_res").val().trim();	//	填写内容
					/*if( "" == _content || "" == _contentRes ){
						document.getElementById("a_err_3").style.display="";
						return false;
					}else{
						document.getElementById("a_err_3").style.display="none";
					}*/
					if("" == _content || "" == _contentRes){
						myFactory.alert('','请完整填写未偿还金额及原因！','info');
						return false;
					}
				}

				//	关闭弹出框
				//$("#a_pop_"+_problemId).popup("close");
				//modal('close','main_loan_model','overwindow','main_loan_closeX');
				modal('close','a_pop_'+_problemId,'overwindow','a_pop_'+_problemId+'_closeX');
				$scope.setAccountAnswerYes(_content);
			}

			//	设置财务告知回答为<是>
			$scope.setAccountAnswerYes = function(content){
				//function setAccountAnswerYes(content){
				//	保存页面所填写的内容
				$("#a_" + _role + "_" + _problemId ).val(content);
				//	第三题答案以格式[xxx,xxx]保存
				if( _problemId == "3" ){
					var res_3 = $("#a_number_3_res").val();
					$("#a_" + _role + "_" + _problemId + "_res").val(res_3);
					content = content + "," + res_3;
				}

				//显示区域内容
				hideAccountAnswer();

				//	保存告知信息
				saveNotifyData(_typeAccount,"Y",content);
			}

			//	设置财务告知回答为<否>
			$scope.setAccountAnswerNo = function(problemId,role){
			//function setAccountAnswerNo(problemId,role){
				//	保存数据
				_problemId = problemId ;
				_role	   = role ;

				//$scope.data["a_" + _role + "_flag_" + _problemId+'_checkFlag']=false;
				$scope.data["a_" + _role + "_flag_" + _problemId+'_checkFlagN']=true;
				$scope.data["a_" + _role + "_flag_" + _problemId+'_checkFlagY']=false;
				console.log("N:"+$scope.data["a_" + _role + "_flag_" + _problemId+'_checkFlagN']);
				console.log("Y:"+$scope.data["a_" + _role + "_flag_" + _problemId+'_checkFlagY']);
				//隐藏区域内容
				hideAccountAnswer();

				//	保存告知信息
				saveNotifyData(_typeAccount,"N","");
			}

			//	隐藏财务告知问题内容
			function hideAccountAnswer(){
				var accountAns=new Array("2","3");
				//var accountAns=new Array("2");
				for( var i=0; i < accountAns.length ; i ++ ){
					var _currProblemId= accountAns[i];	//	当前题库编号
					var lfId = "a_tb_lf_" + _currProblemId ;
					//var owId = "a_tb_ow_" + _currProblemId ;

					//var lf_flag = $("input:radio[name=CB_"+_currProblemId.toUpperCase()+"]:checked").val();	//	当前编号对应的被保险人题库值
					//var lf_flag=$scope.data["a_lf_flag_" + _currProblemId+'_checkFlag'];
					//var lf_flag=$("#NCB_"+_currProblemId.toUpperCase()).attr("checked");
					/*if(lf_flag=='checked'){
						//console.log("selected:"+type);
					}else{
						//console.log("selected:"+type);
					}*/
					var lf_flag=$scope.data["a_lf_flag_" + _currProblemId+'_checkFlagY'];

					//	没有选择被保险人的"是、否"选项时隐藏当前变更项所属区域块内容
					/*if( "Y" == lf_flag){
						document.getElementById(lfId).style.display="";
					} else {
						document.getElementById(lfId).style.display="none";
					}*/
					if(lf_flag){
						$scope.data["a_lf_" + _currProblemId+'_ShowFlag']=true;
					} else {
						$scope.data["a_lf_" + _currProblemId+'_ShowFlag']=false;
					}

					/*var ow_flag = $("input:radio[name=CT_"+_currProblemId.toUpperCase()+"]:checked").val();	//	当前编号对应的投保人题库值
					//	没有选择投保险人的"是、否"选项时隐藏当前变更项所属区域块内容
					if( "Y" == ow_flag){
						document.getElementById(owId).style.display="";
					} else {
						document.getElementById(owId).style.display="none";
					}*/

					//隐藏
					//$scope.data.a_lf_flag_2_checkFlag = false;
					//$scope.data["a_" + _role + "_flag_" + _problemId+'_checkFlag']=false;
					//console.log("test.....:"+$scope.data["a_lf_flag_"+_problemId+'_checkFlag']);
					/*$scope.data.a_lf_flag_2_checkFlag = false;
					 if ($scope.data.a_lf_2_ShowFlag) {
					 $scope.data.a_lf_2_ShowFlag = false;
					 };*/
					//$scope.data["a_" + _role + "_" + _problemId+'_ShowFlag']=false;
					//var lf_flag = $("input:radio[name=CB_2]:checked").val();//on
					//console.log("lf_flag no:"+lf_flag);

					//显示
					/*console.log($scope.data.mainLoanMoney);
					 console.log(angular.isNumber($scope.data.mainLoanMoney));
					 if (angular.isNumber($scope.data.mainLoanMoney)) {
					 $scope.data.mainLoanAddFlag =true;
					 };*/
					//console.log(content);
					//console.log(angular.isNumber(content));
					//$scope.data.a_lf_2_ShowFlag =true;
					//$scope.data["a_" + _role + "_" + _problemId+'_ShowFlag']=true;
					//var lf_flag = $("input:radio[name=CB_2]:checked").val();
					//console.log("lf_flag yes:"+lf_flag);
				}
			}

			function showAnswerQueestion3(a_lf_3){
				/*****  被保人 ****/
				//var hisCnt = '${a_lf_3 }';		//	原有填写金额及原因内容
				var hisCnt = a_lf_3;
				var arrs = hisCnt.split(',');
				$("#a_lf_3").val(arrs[0]);		//	金额
				$("#a_lf_3_res").val(arrs[1]);	//	原因
				/****** 投保人 *****/
				/*hisCnt = '${a_ow_3 }';			//	原有填写金额及原因内容
				arrs = hisCnt.split(',');
				$("#a_ow_3").val(arrs[0]);		//	金额
				$("#a_ow_3_res").val(arrs[1]);	//	原因*/
			}

			/**********************  财务告知 end **************************/




			/**
			 * 保存数据到后台
			 * type - 告知类型 (H-健康告知,A-财务告知,B-职业告知)
			 * flag - 答题状态位（是、否）
			 * content - 答题内容
			 **/
			function saveNotifyData(_type,_flag,_content){
				var ret = false;
				var returnFlag="";
				//	对字符串编码
				var deContent = encodeURI(_content);
				var timestamp=myFactory.getTimetamp();
				var sfis= "type-problemId-role-flag-token-timestamp";
				var signStr="type="+_type+"&problemId="+_problemId+"&role="+_role+"&flag="+_flag+"&token="+token+"&timestamp="+timestamp;//encodeURI(name)
				var sign = myFactory.hex(signStr);
				var param = {'type':_type,'problemId':_problemId,'role':_role,'flag': _flag,'content':deContent,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp};
				/*jQuery.ajax({
					type:"post",
					url:basePath+"/common/saveNotify.action",
					data:param,
					async:true,
					dataType:"JSON",
					success:function(data){
						if(data == "fail"){
							ret = true;
						}
					}
				});*/
				$http({
					method: 'GET',
					url: app.domain + 'common/saveNotify.action',
					params: param
				}).then(function successCallback(response) {
					if (response.data.success) {
						returnFlag = response.data.data.returnFlag;
						if(returnFlag == "fail"){
							ret = true;
						}
					}
				}, function errorCallback(response) {
					$.alert({
						title: '',
						text: '查询失败!',
						onOK: function () {
						}
					});
				});

				return ret;
			}

			//下一步
			$scope.nextStep = function(){
				//判断是否初始化完成了，如果失败，不予进入下一步
				if(!initFlag){
					myFactory.alert("","初始化时失败，请返回上一步重试","info");
					return;
				}
				
				/*S2020050812880-个人信息安全项目-修改变更项目录入页面的个人信息授权内容需求 add by yangyan 20200615 start*/
				//检测查阅弹框
		        var readImageFlag = $("#readImageFlag").val();
	    		if(readImageFlag=="false"){
	    			//S2020050812880-个人信息安全项目-修改变更项目录入页面的个人信息授权内容需求 add by yangyan 20200615 start
	    			myFactory.alert('',"请阅读《投保人和被保险人声明与授权事项》和《中信保诚隐私政策》！",'info');
	    			//S2020050812880-个人信息安全项目-修改变更项目录入页面的个人信息授权内容需求 add by yangyan 20200615 end
	    			return;
	    		}	
	    		/*S2020050812880-个人信息安全项目-修改变更项目录入页面的个人信息授权内容需求 add by yangyan 20200615 end*/
				
                //	检测数据是否完整
				/*var res = checkNotify();
				if( res == true ){
					var nextNotifyUrl = $("#nextNotifyUrl").val();
					loader();
					$("#nextNotify").attr("href",nextNotifyUrl);
				}
				console.log("res:"+res);
				alert("res:"+res);*/

				var timestamp=myFactory.getTimetamp();
				var sfis= "param1-token-timestamp";
				var signStr="param1="+"22"+"&token="+token+"&timestamp="+timestamp;//encodeURI(name)
				var sign = myFactory.hex(signStr);
				var ret = false;
				//	对字符串编码
				var param = {'param1':"22",'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp};
				$http({
					method: 'GET',
					url: app.domain + 'common/checkNotify.action',
					params: param
				}).then(function successCallback(response) {
					if (response.data.success) {
						var data = response.data.data.result;
						if(data == "Y"){
							ret = true;
						} else if( "1" == data ){
							//	健康告知信息填写不完整
							//alert("健康告知信息填写不完整");
							myFactory.alert('','健康告知信息填写不完整！','info');
						}
						/*else if( "2" == data ){
							//alert("财务告知信息填写不完整");
							myFactory.alert('','财务告知信息填写不完整！','info');
						}*/
						else if( "3" == data ){
							//alert("职业告知信息填写不完整");
							myFactory.alert('','职业告知信息填写不完整！','info');
						}
						else {
							//alert("未知信息填写不完整");
							myFactory.alert('','未知信息填写不完整！','info');
						}

						if(ret){
							console.log('复效告知检测通过');
							//myFactory.alert('','复效告知检测通过！','info');
							item23["sourceFlag"] = "";
							var item=item23;
							$ionicHistory.clearCache().then(function(){
								$state.go('content_check_main',{
									itemId:itemId,item:item,chdrnum01:chdrnum01,chdrcoy:chdrcoy
								});
							})
						}else{
							console.log('复效告知检测不通过');
						}
						//无条件跳转测试
						/*alert('无条件跳转测试');
						item23["sourceFlag"] = "";
						var item=item23;
						$ionicHistory.clearCache().then(function(){
							$state.go('content_check_main',{
								itemId:itemId,item:item,chdrnum01:chdrnum01,chdrcoy:chdrcoy
							});
						})*/

					}
				}, function errorCallback(response) {
					$.alert({
						title: '',
						text: '查询失败!',
						onOK: function () {
						}
					});
				});

			}

			/**
			 * 检测数据是否填写完整
			 * type - 告知类型 (H-健康告知,A-财务告知,B-职业告知)
			 * flag - 答题状态位（是、否）
			 * content - 答题内容
			 **/
			function checkNotify(){
				var ret = false;
				var timestamp=myFactory.getTimetamp();
				var sfis= "param1-token-timestamp";
				var signStr="param1="+"22"+"&token="+token+"&timestamp="+timestamp;//encodeURI(name)
				var sign = myFactory.hex(signStr);
				var ret = false;
				//	对字符串编码
				var param = {'param1':"22",'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp};
				$http({
					method: 'GET',
					url: app.domain + 'common/checkNotify.action',
					params: param
				}).then(function successCallback(response) {
					if (response.data.success) {
						var data = response.data.data.result;
						if(data == "Y"){
							ret = true;
						} else if( "1" == data ){
							//	健康告知信息填写不完整
							//alert("健康告知信息填写不完整");
							myFactory.alert('','请完整填写未偿还金额及原因！','info');
						} else if( "2" == data ){
							//alert("财务告知信息填写不完整");
							myFactory.alert('','财务告知信息填写不完整！','info');
						} else if( "3" == data ){
							//alert("职业告知信息填写不完整");
							myFactory.alert('','职业告知信息填写不完整！','info');
						} else {
							//alert("未知信息填写不完整");
							myFactory.alert('','未知信息填写不完整！','info');
						}
					}
				}, function errorCallback(response) {
					$.alert({
						title: '',
						text: '查询失败!',
						onOK: function () {
						}
					});
				});
				return ret;
			}

			//S2020050812880-个人信息安全项目-修改变更项目录入页面的个人信息授权内容需求 add by yangyan 20200615 start
			//客户须知弹框
			$scope.tipOpen = function(){
				modal('open','a_pop_4','overwindow','a_pop_4_closeX');
			}
			$scope.tipClose = function(){
				modal('close','a_pop_4','overwindow','a_pop_4_closeX');
			}
			//页面同意阅读协议复选框部分
			$scope.changeReadFlag = function(){
				$scope.readFlag = !$scope.readFlag;
			}
			
			$scope.privacyOpen = function(){ 
				$state.go('privacy', {
                    itemId: itemId,
                    chdrnum01: chdrnum01,
                    chdrcoy: chdrcoy
                });
			}
			//S2020050812880-个人信息安全项目-修改变更项目录入页面的个人信息授权内容需求 add by yangyan 20200615 end 

		}]);        
})(app)